<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/fmt.tld" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<%@ taglib uri="/WEB-INF/tld/sys.tld" prefix="sys" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>拖车单信息页面</title>
<jsp:include page="../../import.jsp" flush="true" />
<jsp:include page="../assParking/assParkCommon.jsp" flush="true" /><!-- 时间格式转换 -->
<script type="text/javascript" src="<%=path %>/resource/lib/plugins/ajaxfileupload.js"></script>
</head>
<body class="iframeBody">
	<div class="Wrapper">
		<div>
			<form id="trailCar_view">
				<div class="fieldset1 tabel_col clearFix">
					<div class="fieldBox col_50">
						<div class="label">申请人</div>
		                <div class="field">
		                    <span id="applyNm" name="applyNm">&nbsp;</span>
		                </div>
					</div>
		            <div class="fieldBox col_50">
						<div class="label">申请时间</div>
						<div class="field">
							<span id="applyDt" name="applyDt">&nbsp;</span>
						</div>
					</div>
					<!-- 基本信息 -->
					<div class="caption">
						<span class="title">基本信息</span>
					</div>
		            <div class="fieldBox col_33">
						<div class="label">承租人</div>
						<div class="field">
							<span id="cstNm" name="cstNm">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">合同编号</div>
						<div class="field">
							<span id="contNo" name="contNo">&nbsp;</span>
						</div>
					</div>
		            <div class="fieldBox col_33">
		                <div class="label">支付表号</div>
		                <div class="field">
		                    <span id="paySchNo_1" name="paySchNo_1">&nbsp;</span>
		                </div>
		            </div>
		            <div class="fieldBox col_33">
						<div class="label">经销商</div>
						<div class="field">
							<span id="splNm" name="splNm">&nbsp;</span>
						</div>
					</div>
		            <div class="fieldBox col_33">
						<div class="label">事业部</div>
						<div class="field">
							<span id="orgName" name="orgName">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">业务负责人</div>
						<div class="field" style="width: 100%;">
							<span id="cstMgrNm" name="cstMgrNm">&nbsp;</span>
						</div>
					</div>
					<!-- 设备信息 -->
					<div class="caption">
						<span class="title">设备信息</span>
					</div>
					<div class="fieldBox col_100">
						<div class="sqPanel">
							<div id="detailGrid">
								<!-- 设备信息列表显示块 -->
								<div id="ligergrid_equ" class="sq-grid"></div>
							</div>
						</div>
					</div>
					<!-- 逾期信息 -->
					<div class="caption">
						<span class="title">逾期信息</span>
					</div>
		            <div class="fieldBox col_33">
						<div class="label">租赁周期</div>
						<div class="field">
							<span id="lsPd" name="lsPd">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">已还租金(元)</div>
						<div class="field">
							<span id="actualAmt" name="actualAmt">&nbsp;</span>
						</div>
					</div>
		            <div class="fieldBox col_33">
		                <div class="label">逾期租金(元)</div>
		                <div class="field">
		                    <span id="overdueAmt" name="overdueAmt">&nbsp;</span>
		                </div>
		            </div>
		            <div class="fieldBox col_33">
						<div class="label">逾期天数</div>
						<div class="field">
							<span id="overdueDay" name="overdueDay">&nbsp;</span>
						</div>
					</div>
		            <div class="fieldBox col_33">
						<div class="label">罚息金额(元)</div>
						<div class="field">
							<span id="penaltyAmt" name="penaltyAmt">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">应还款金额(元)</div>
						<div class="field">
							<span id="payAmt" name="payAmt">&nbsp;</span>
						</div>
					</div>
					<!-- 拖车信息 -->
					<div class="caption">
						<span class="title">拖车信息</span>
					</div>
		            <div class="fieldBox col_100">
						<div class="label">拖车原因</div>
						<div class="field">
							<span id="backReason" name="backReason">&nbsp;</span>
						</div>
					</div>
					<!-- 附件显示 -->
					<div class="fieldBox col_100">
						<div style="width: 98%; margin-left: 1%;">
							<jsp:include page="../assCommFilesList.jsp" flush="true" ></jsp:include>
							<div id="ligergrid_file1" class="sq-grid"></div>
						</div>
					</div>
					<!-- 可编辑信息 -->
					<div class="fieldBox col_33">
						<div class="label">拖车单位名称</div>
						<div class="field">
							<span id="companyNm" name="companyNm">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">预计拖回时间</div>
						<div class="field">
							<span id="backDt" name="backDt">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">拖回保管城市</div>
						<div class="field">
							<span id="provinceCity" name="provinceCity">&nbsp;</span>
						</div>
					</div>
		            <div class="fieldBox col_33">
						<div class="label">停车场名称</div>
						<div class="field">
							<span id="parkNm" name="parkNm">&nbsp;</span>
						</div>
					</div>
		            <div class="fieldBox col_66">
						<div class="label">停车场地址</div>
						<div class="field">
							<span id="parkAddress" name="parkAddress">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">优车资产管理员</div>
						<div class="field">
							<span id="assMgs" name="assMgs">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">拖车费用(元/辆)</div>
						<div class="field">
							<span id="backPrice" name="backPrice">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">拖车数量</div>
						<div class="field">
							<span id="backQty" name="backQty" >&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">拖车费合计(元)</div>
						<div class="field">
							<span id="backAmt" name="backAmt">&nbsp;</span>
						</div>
					</div>
                    <div class="fieldBox col_33">
                        <div class="label">拖回方式</div>
                        <div class="field">
                            <select name="backWayCd" id="backWayCd" >
                                <option value=" " selected="selected" >--请选择--</option>
                                <c:forEach items="${backWayCd}" var="backWayCd">
                                    <option value="${backWayCd.key}">${backWayCd.value}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
					<!-- 杂费信息 -->
					<!-- <div class="caption">
						<span class="title">杂费信息</span>
					</div> -->
					<div class="fieldBox col_100">
						<div class="sqPanel">
			                <div class="sqPanel_head inL">
			                    <div class="btnsBox inLC">
			                    	<c:if test="${mdfSellCost==1 }">
				                        <span id="addBtn" class="sq-button sq-button-round" onclick="addRecord();">添加</span>
			                    	</c:if>
			                    </div>
			                    <span>杂费信息</span>
			                </div>
			                <div class="sqPanel_body">
								<div id="ligergrid_cost" class="sq-grid"></div>
			                </div>
			            </div>
					</div>
					<c:if test="${mdfSellCost==1 }">
					    <div class="fieldset1 clearFix">
					        <div class="btnsBox" style="text-align: center;">
						        	<span id="saveCost" class="sq-button sq-button-round" onclick="saveCost();">保存</span>
						    </div>
					    </div>
					</c:if>
                    <div class="caption">
                        <span class="title">杂费资料</span>
						</div>
                    <!-- 附件显示 -->
                    <div class="fieldBox col_100">
						    <div id="costFileGrid" class="sq-grid"></div>
			            </div>
					<div class="fieldBox col_100">
						<div class="label">备注</div>
						<div class="field">
							<input name="costFileRem" id="costFileRem" value="" type="text" class="ui-textbox">
						</div>
					</div>
					<c:if test="${mdfSellCost==1 }">
					    <div class="fieldset1 clearFix">
					        <div class="btnsBox" style="text-align: center;">
						        	<span id="saveCostFileRem" class="sq-button sq-button-round" onclick="saveCostFileRem();">保存</span>
						    </div>
					    </div>
					</c:if>
					<!-- 收款信息 -->
					<div class="caption">
						<span class="title">收款信息</span>
					</div>
					<div class="fieldBox col_33">
						<div class="label">收款方名称</div>
						<div class="field">
							<span id="payeeAccNm" name="payeeAccNm">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">开户银行</div>
						<div class="field">
							<span id="payeeBankNm" name="payeeBankNm">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">开户行行号</div>
						<div class="field">
							<span id="payeeBankNo" name="payeeBankNo">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">银行账号</div>
						<div class="field">
							<span id="payeeAccNo" name="payeeAccNo">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">实际拖回时间</div>
						<div class="field">
							<span id="actBackDt" name="actBackDt">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label"></div>
						<div class="field"></div>
					</div>
                    <div class="caption">
                        <span class="title">函件发送信息</span>
                    </div>
                    <div class="fieldBox col_100">
                        <div class="label">函件是否发送</div>
                        <div class="field">
                            <select name="isSendFile" id="isSendFile">
                                <option value=" " selected="selected" >-请选择-</option>
                                <option value="1" >是</option>
                                <option value="0" >否</option>
                            </select>
                        </div>
                    </div>
                    <div class="fieldBox col_100 notSendReasonDiv Hide">
                        <div class="label">不发送原因</div>
                        <div class="field">
                            <textarea name="notSendReason" id="notSendReason" rows="2" class="l-textarea" style="width:98%" value="" disabled></textarea>
                        </div>
                    </div>
                    <div class="fieldBox col_33 expressNmDiv Hide">
                        <div class="label">快递承运公司</div>
                        <div class="field">
                            <select name="expressNm" id="expressNm" >
                                <option value=" " selected="selected" >-请选择-</option>
                                <c:forEach items="${expressNm}" var="expressNm">
                                    <option value="${expressNm.key}">${expressNm.value}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                    <div class="fieldBox col_33 expressNumDiv Hide">
                        <div class="label">快递单号</div>
                        <div class="field">
                            <input name="expressNum" id="expressNum" value="" type="text" class="ui-textbox" >
                        </div>
                    </div>
                    <div class="fieldBox col_33 rcvRelationshipDiv Hide">
                        <div class="label">接收人关系</div>
                        <div class="field">
                            <select name="rcvRelationship" id="rcvRelationship" >
                                <option value=" " selected="selected" >-请选择-</option>
                                <c:forEach items="${rcvRelationship }" var="rcvRelationship">
                                    <option value="${rcvRelationship.key}">${rcvRelationship.value}</option>
                                </c:forEach>
                            </select>
                        </div>
                    </div>
                    <div class="fieldBox col_33 rcvNmDiv Hide">
                        <div class="label">收件人</div>
                        <div class="field">
                            <input name="rcvNm" id="rcvNm" value="" type="text" class="ui-textbox" >
                        </div>
                    </div>
                    <div class="fieldBox col_33 rcvTelDiv Hide">
                        <div class="label">收件人手机号</div>
                        <div class="field">
                            <input name="rcvTel" id="rcvTel" value="" type="text" class="ui-textbox" >
                        </div>
                    </div>
                    <div class="fieldBox col_33 rcvAddrDiv Hide">
                        <div class="label">收件地址</div>
                        <div class="field">
                            <input name="rcvAddr" id="rcvAddr" value="" type="text" class="ui-textbox" >
                        </div>
                    </div>
                    <!-- 附件显示 -->
                    <div class="fieldBox col_100 hanjian Hide">
                        <div style="width: 98%; margin-left: 1%;">
                            <div id="ligergrid_file4" class="sq-grid"></div>
                        </div>
                    </div>
					<!-- 付款信息 -->
					<div class="caption fkxx">
						<span class="title">付款信息</span>
					</div>
					<div class="fieldBox col_33">
						<div class="label">付款方名称</div>
						<div class="field">
							<span name="payerAccNm" id="payerAccNm">&nbsp;</span><!-- 狮桥融资租赁（中国）有限公司 -->
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">开户银行</div>
						<div class="field">
							<span name="payerBankNm" id="payerBankNm">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">银行账号</div>
						<div class="field">
							<span name="payerAccNo" id="payerAccNo">&nbsp;</span>
						</div>
					</div>
					<!-- 未来本金等值,实际明细 -->
					<div class="fieldBox col_33">
						<div class="label">未来本金(元)</div>
						<div class="field">
							<span name="futureAmt" id="futureAmt">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">逾期租金(元)</div>
						<div class="field">
							<span name="overRentAmt" id="overRentAmt">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">履约保证金(元)</div>
						<div class="field">
							<span name="performanceAmt" id="performanceAmt">&nbsp;</span>
						</div>
					</div>
					<!-- 保险保证金等值,实际明细 -->
					<div class="fieldBox col_33">
						<div class="label">保险保证金(元)</div>
						<div class="field">
							<span name="insureAmt" id="insureAmt">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">其他费用(元)</div>
						<div class="field">
							<span name="otherAmt" id="otherAmt">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">风险保证金(元)</div>
						<div class="field">
							<span name="riskAmt" id="riskAmt">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33 lgj_cyc">
						<div class="label">留购价(元)</div>
						<div class="field">
							<span name="rsrvPc" id="rsrvPc">&nbsp;</span>
						</div>
					</div>
					<!-- 实际付款时间等值,实际明细 -->
					<div class="fieldBox col_33">
						<div class="label">实际付款时间</div>
						<div class="field">
							<span id="actPayDt" name="actPayDt">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">实际付款金额(元)</div>
						<div class="field">
							<span id="actPayAmt" name="actPayAmt">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33">
						<div class="label">保底价款(元)</div>
						<div class="field">
							<span name="baseAmt" id="baseAmt">&nbsp;</span>
						</div>
					</div>
					<div class="fieldBox col_33 show_cyc">
						<div class="label"></div>
						<div class="field"></div>
					</div>
					<div class="fieldBox col_33 show_cyc">
						<div class="label"></div>
						<div class="field"></div>
					</div>
					
					<!-- 借款信息holly START-->
					<div class="caption">
						<span class="title">借款信息</span>
					</div>
					<div class="fieldBox col_100">
						<div class="sqPanel">
							<div id="detailGrid">
								<!-- 借款信息列表显示块 -->
								<div id="ligergrid_fin" class="sq-grid"></div>
							</div>
						</div>
					</div>
					<div class="fieldBox col_50">
						<div class="label  requiredSymbol"  >剩余未核销金额合计(元)</div>
						<div class="field col_50"  >
							<span id="arAmts" name="arAmts"> </span>
						</div>
					</div>
					<!-- 借款信息holly END-->
					
					
					
					<!-- 经营贷信息 -->
					<div class="caption">
						<span class="title">经营贷信息</span>
					</div>
					<div class="fieldBox col_100">
						<div class="sqPanel">
							<div id="detailGrid">
								<!-- 经营贷信息列表显示块 -->
								<div id="ligergrid_loan" class="sq-grid"></div>
							</div>
						</div>
					</div>
										<!-- LNG专项信息 -->
					<div class="caption">
						<span class="title">LNG专项信息</span>
					</div>
					<div class="fieldBox col_100">
						<div class="sqPanel">
							<div id="detailGrid">
								<!-- LNG专项信息列表显示块 -->
								<div id="ligergrid_lng" class="sq-grid"></div>
							</div>
						</div>
					</div>
					<!-- 保险贷信息 -->
					<div class="caption">
						<span class="title">保险贷信息</span>
					</div>
					<div class="fieldBox col_100">
						<div class="sqPanel">
							<div id="detailGrid">
								<!-- 保险贷信息列表显示块 -->
								<div id="ligergrid_ins" class="sq-grid"></div>
							</div>
						</div>
					</div>
                    <!-- YQ信息 -->
                    <div class="caption">
                        <span class="title">YQ信息</span>
                    </div>
                    <div class="fieldBox col_100">
                        <div class="sqPanel">
                            <div id="detailGrid">
                                <!-- 保险贷信息列表显示块 -->
                                <div id="ligergrid_yq" class="sq-grid"></div>
                            </div>
                        </div>
                    </div>
					<!-- 含小额贷保底价格合计 -->
					<div class="fieldBox col_33 edit_payer">
						<div class="label">含小额贷保底价格合计</div>
						<div class="field">
							<input name="baseAllAmt" id="baseAllAmt" value="" type="text" class="ui-textbox" validate="{number:true}">
						</div>
					</div>
					<div class="fieldBox col_100">
								<div class="edit_loan" style="text-align: center;line-height: 3em;">
									<span id="saveInsLngMCrInfo" class="sq-button sq-button-round" onclick="saveInsLngMCrInfo()">保存</span>
								</div>
					</div>
					
					
					<!-- 拖车交接单 -->
	                <div class="fieldBox col_33 tcjjd">
	                	<div class="label">拖车交接单</div>
	                    <div class="field">
							<a class="entry Hide" href="javascript:void(0);" onclick="entryOrder('entry')">入库</a>
							<a class="out Hide" href="javascript:void(0);" onclick="entryOrder('out')">出库</a>
							<a class="detail Hide" href="javascript:void(0);" onclick="entryOrder('detail')">查看</a>
	                    </div>
	                </div>
	                <div class="fieldBox col_66 tcjjd">
	                    <div class="field">
	                         <a href="javascript:void(0);" onclick="exportAssCarHvPdf()">导出</a>
	                    </div>
	                </div>
	                <!-- 车辆出入库资料  -->
					<div class="caption crkzl">
						<span class="title">车辆出入库资料</span>
					</div>
					<!-- 附件显示 -->
					<div class="fieldBox col_100">
						<div style="width: 98%; margin-left: 1%;">
							<div id="ligergrid_file2" class="sq-grid"></div>
						</div>
					</div>
					<!-- 隐藏支付表主键、支付表号 -->
	                <div class="fieldBox col_100" style="display:none;">
	                    <div class="field">
	                         <input name="paySchId" id="paySchId" type="text" class="ui-textbox" value="${paySchId }">
	                         <input name="paySchNo" id="paySchNo" type="text" class="ui-textbox" value="${paySchNo }">
                             <input name="wsPaySchId" id="wsPaySchId" type="text" class="ui-textbox" value="${wsPaySchId}">
                             <input name="wsPaySchNo" id="wsPaySchNo" type="text" class="ui-textbox" value="${wsPaySchNo}">
                             <input name="prjPrdDtlId" id="prjPrdDtlId" type="text" class="ui-textbox" value="">
	                         <input name="prjId" id="prjId" type="text" class="ui-textbox" value="${prjId }">
	                         <input name="tcMasterId" id="tcMasterId" type="text" class="ui-textbox" value="${tcMasterId }">
	                         <input name="tcDetailId" id="tcDetailId" type="text" class="ui-textbox" value="${tcDetailId }">
	                         <input name="tcInfoId" id="tcInfoId" type="text" class="ui-textbox" value="${tcInfoId }">
	                         <input name="crflag" id="crflag" type="text" class="ui-textbox" value="${crflag }">
	                         
	                         <input name="busid" id="busid" type="text" class="ui-textbox" value="${busid}">
	                         <input name="processId" id="processId" type="text" class="ui-textbox" value="${processId}">
	                         <input name="taskDefKey" id="taskDefKey" type="text" class="ui-textbox" value="${taskDefKey}">
	                    </div>
	                </div>
				</div>
			</form>
		</div>
	</div>

    <script>
	    $(function() {
	    	initForm();//初始化表单
	        initData();//初始化数据
	        setEnterOutAttr();//出入库状态
	    	loadFilesLiger("tcsq", 1, $("#tcMasterId").val());//加载拖车置申请文件列表信息
            loadFilesLiger("tcsq_hj", 4, $("#tcMasterId").val());
	    	initData_loan();//初始化数据经营贷信息-LNG专项信息
	    	initAll_Money();//初始化保底价价+经营贷+lng贷+保险贷
	    	showOrEdit();
	    	initCostGrid();
	    	initCostFlie();

	    	var mdfSellCost = '${mdfSellCost}';
	    	if(mdfSellCost!=1){
            	if(liger.get("costFileRem")){
            		liger.get("costFileRem").setDisabled(true);
            	}
            	
            }
	    });

        function setHjShow(isSendFile) {
            if ("0" == isSendFile) {
                $(".notSendReasonDiv").removeClass('Hide');
                $(".hanjian").removeClass('Hide');
            } else if ("1" == isSendFile) {
                $(".expressNmDiv").removeClass('Hide');
                $(".expressNumDiv").removeClass('Hide');
                $(".rcvRelationshipDiv").removeClass('Hide');
                $(".rcvNmDiv").removeClass('Hide');
                $(".rcvTelDiv").removeClass('Hide');
                $(".rcvAddrDiv").removeClass('Hide');
            }
        }

	    // 初始化疫情信息
	    function initData_yq() {
            var prjPrdDtlId = $("#prjPrdDtlId").val();
            var assTrailMId = $("#tcMasterId").val();
            $("#ligergrid_yq").ligerGrid({
                url:'<%=path%>/ass/assTrailCarM/searchYQPayInfo.do',
                method:'get',
                parms:{prjPrdDtlId:prjPrdDtlId, assTrailMId: assTrailMId},
                columns:[
                    {display: '合同号', name: 'contNo', minWidth: 160, enabledSort: true},
                    {
                        display: '支付表号', name: 'yqPaySchNo', minWidth: 150, enabledSort: true,
                    },
                    {
                        display: '实际贷款金额(元)', name: 'actualLoanAmt', width: 100, enabledSort: true,
                        editor: {type: "int"},
                        render: function (rowdata, rowindex, value, column) {
                            return '&yen;' + FormatMoney(rowdata.actualLoanAmt / 100);
                        }
                    },
                    {
                        display: '已还本金合计(元)', name: 'paidCapAmt', width: 100, enabledSort: true,
                        editor: {type: "int"},
                        render: function (rowdata, rowindex, value, column) {
                            return '&yen;' + FormatMoney(rowdata.paidCapAmt / 100);
                        }
                    },
                    {
                        display: '已还利息合计(元)', name: 'paidIntrAmt', width: 100, enabledSort: true,
                        editor: {type: "int"},
                        render: function (rowdata, rowindex, value, column) {
                            return '&yen;' + FormatMoney(rowdata.paidIntrAmt / 100);
                        }
                    },
                    {
                        display: '已还罚息合计(元)', name: 'paidPenaltyAmt', width: 100, enabledSort: true,
                        editor: {type: "int"},
                        render: function (rowdata, rowindex, value, column) {
                            return '&yen;' + FormatMoney(rowdata.paidPenaltyAmt / 100);
                        }
                    },
                    {
                        display: '剩余本金合计(元)', name: 'surplusCapAmt', width: 100, enabledSort: true,
                        editor: {type: "int"},
                        render: function (rowdata, rowindex, value, column) {
                            return '&yen;' + FormatMoney(rowdata.surplusCapAmt / 100);
                        }
                    },
                    {
                        display: '剩余利息合计(元)', name: 'surplusIntrAmt', width: 100, enabledSort: true,
                        editor: {type: "int"},
                        render: function (rowdata, rowindex, value, column) {
                            return '&yen;' + FormatMoney(rowdata.surplusIntrAmt / 100);
                        }
                    },
                    {
                        display: '逾期租金合计(元)', name: 'overRentAmt', width: 100, enabledSort: true,
                        editor: {type: "int"},
                        render: function (rowdata, rowindex, value, column) {
                            return '&yen;' + FormatMoney(rowdata.overRentAmt / 100);
                        }
                    },
                    {
                        display: 'YQ应收结清款(元)', name: 'clearAmt', width: 100, enabledSort: true,
                        editor: {type: "int"},
                        render: function (rowdata, rowindex, value, column) {
                            return '&yen;' + FormatMoney(rowdata.clearAmt / 100);
                        }
                    },
                ],
                enabledEdit: true,
                usePager: false,//是否有分页便签
                root:'rows',
                record:'total',
                hideLoadButton:false,
                width:'100%',
                isScroll: false,//是否有滚动条
                checkbox: false, //列表是否有选择框
                rownumbers:true//列表是否有行号
            });
            grid = liger.get("ligergrid_yq");
            grid.options.isSingleCheck = true;//列表是否为单选
        }
	    
		//设置显示/编辑属性
		function showOrEdit(){
			var busid = $("#busid").val();
			//alert(busid);
			if(busid==""||!busid){
				$(".edit_loan").addClass('Hide');
			}else{
				
				$(".edit_loan").removeClass('Hide');
			}
		}
	    function saveInsLngMCrInfo(){
	    	
			var ligerForm = liger.get("trailCar_view");
			grid = liger.get("ligergrid_loan");
			var dataLoan = grid.getData();
			
			var data = ligerForm.getData();
			data["ligergrid_loan"]=JSON.stringify(dataLoan);
			grid = liger.get("ligergrid_lng");
			var datalng = grid.getData();
			data["ligergrid_lng"]=JSON.stringify(datalng);
			grid = liger.get("ligergrid_ins");
			var datains = grid.getData();
			data["ligergrid_ins"]=JSON.stringify(datains);

			$.ajax({
				type: 'post',
				dataType: 'json',
				data: data,
				url: '<%=path%>/ass/assTrailCarFlowInfo/saveInsLngMCrInfo.do',
				beforeSend: function(){
					wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
				},
				success:function(msg){
					wait_dialog.close();
					//返回的赎回信息主表ID不为空执行一下操作
					if(msg.success == 1){
						top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
					}else{
						top.$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
					}
				}
			});
		}
		//初始化表单
		function initForm(){
	    	$("#trailCar_view").ligerForm({
				validate: true
			});
			$("#trailCar_view").check_ligerFormEditor();//重新刷新页面动态字段
		};
		
		 //初始化保底价价+经营贷+lng贷+保险贷
	    function initAll_Money(){
            var tcMasterId = $("#tcMasterId").val();
            if (!tcMasterId) {
                $.ligerDialog.SQalert({content: "拖车申请主表ID为空,无法查询相关信息！", SQ_type: "error"});
                return;
            }
            //加载拖车主表信息
            var _url = '<%=path%>/ass/assTrailCarFlowInfo/getAllMoney.do';
            $.ajax({
                type: 'get',
                dataType: 'json',
                data: {tcMasterId: tcMasterId, paySchId: paySchId},
                url: _url,
                success: function (msg) {
                    if (msg.success == 1) {
                        var paySchId = $("#paySchId").val();
                        var baseAmt = msg.data.baseAmt;
                        var _url2 = "<%=path%>/ass/assTrailCarM/calcYQOvdAndFutureByPaySchId.do";
                        $.ajax({
                            type: 'get',
                            dataType: 'json',
                            data: {paySchId: paySchId},
                            url: _url2,
                            success: function (msg) {
                                if (msg.success == 1) {
                                    // 疫情逾期租金
                                    var yqOvdRentAmt = (isNaN(msg.data.ovdRentAmt) || msg.data.ovdRentAmt == '') ? 0 : msg.data.ovdRentAmt;
                                    // 疫情未来本金
                                    var yqFutureCapAmt = (isNaN(msg.data.futureCapAmt) || msg.data.futureCapAmt == '') ? 0 : msg.data.futureCapAmt;
                                    // 设置含小额贷保底价数据
                                    $("#baseAllAmt").val((baseAmt + yqOvdRentAmt + yqFutureCapAmt) / 100);
                                } else {
                                    $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                                }
                            }
                        });
                    } else {
                        $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                    }
                }
            });
        }
	  
	    //初始化数据经营贷信息-LNG专项信息
	    function initData_loan(){
	    	var tcMasterId = $("#tcMasterId").val();
	    	if(!tcMasterId){
	    		$.ligerDialog.SQalert({content: "拖车申请主表ID为空,无法查询相关信息！",SQ_type: "error"});
	    		return;
	    	}
	    	
	    	//经营贷信息
	    	initGrid_loan(tcMasterId);
	    	//LNG专项信息
	    	initGrid_lng(tcMasterId);
	    	//保险信息
	    	initGrid_ins(tcMasterId);
		 }
	    //初始化列表
		function initGrid_ins(id){
			
			$("#ligergrid_ins").ligerGrid({
				url:'<%=path%>/ass/assTrailCarFlowInfo/getInsPayInfo.do',
				method:'get',
				parms:{tcMasterId:id,loanType:1},
				columns:[
					{ display: '贷款合同号', name: 'contNo', minWidth: 160, enabledSort:true},
					{ display: '贷款类型', name: 'loanType', minWidth: 150 , enabledSort:true,
						render: function (rowdata, rowindex, value, column) { 
							var h = '';
							if(rowdata.loanType=='1'){
								h = '分期还款';
							}
							if(rowdata.loanType=='2'){
								h = '全款';
							}
							return h;
						}
					
					
					},
					
					{ display: '实际贷款金额(元)', name: 'insTotalAmt', width: 100 , enabledSort:true,
						 editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.insTotalAmt / 100;
								return h;
							}
					},
					{ display: '已还本金合计(元)', name: 'totCapAmt', width: 100 , enabledSort:true,
						 editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.totCapAmt / 100;
								return h;
							}
					},
					{ display: '已还利息合计(元)', name: 'totIntrAmt', width: 100, enabledSort:true,
						editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.totIntrAmt / 100;
								return h;
							}
					},
					{ display: '已还罚息合计(元)', name: 'totdefaultAmt', width: 100, enabledSort:true,
						editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.totdefaultAmt / 100;
								return h;
							}
					},
					{ display: '剩余本金合计(元)', name: 'overplusCapAmt', width: 100, enabledSort:true,
						editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.overplusCapAmt / 100;
								return h;
							}
					},
					{ display: '剩余利息合计(元)', name: 'overplusIntrAmt', width: 100 , enabledSort:true,
						editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.overplusIntrAmt / 100;
								return h;
							}
					},
					{ display: '剩余罚息合计(元)', name: 'overplusdefaultAmt', width: 100, enabledSort:true,
						editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.overplusdefaultAmt / 100;
								return h;
							}
					},
					{ display: '逾期租金合计(元)', name: 'overdueAmount', width: 100, enabledSort:true,
						editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.overdueAmount / 100;
								return h;
							}
					},
					{ display: '保险贷应收结清款(元)', name: 'clearAmt', width: 100, enabledSort:true,
						editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.clearAmt / 100;
								return h;
							}
					},
				],
				enabledEdit: true, 
				usePager: false,//是否有分页便签
				root:'rows',
				record:'total',
				hideLoadButton:false,
				width:'100%',
				isScroll: false,//是否有滚动条
				checkbox: false, //列表是否有选择框
				rownumbers:true//列表是否有行号
			});
			grid = liger.get("ligergrid_ins");
			grid.options.isSingleCheck = true;//列表是否为单选
		};
	  //初始化列表
		function initGrid_loan(id){
			
			$("#ligergrid_loan").ligerGrid({
				url:'<%=path%>/ass/assTrailCarFlowInfo/getMcrBillInfo.do',
				method:'get',
				parms:{tcMasterId:id,loanType:1},
				columns:[
					{ display: '贷款合同号', name: 'crCntNo', minWidth: 160, enabledSort:true},
					{ display: '贷款类型', name: 'crTypCd', minWidth: 150 , enabledSort:true,
						render: function (rowdata, rowindex, value, column) { 
							var h = '';
							if(rowdata.crTypCd=='FQHK'){
								h = '分期还款';
							}
							if(rowdata.crTypCd=='SJSH'){
								h = '随借随还';
							}
							return h;
						}
					
					},
					
					{ display: '实际贷款金额(元)', name: 'actCrAmt', width: 100 , enabledSort:true,
						 editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.actCrAmt / 100;
								return h;
							}
					},
					{ display: '已还本金合计(元)', name: 'totCapAmt', width: 100 , enabledSort:true,
						 editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.totCapAmt / 100;
								return h;
							}
					},
					{ display: '已还利息合计(元)', name: 'totIntrAmt', width: 100, enabledSort:true,
						editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.totIntrAmt / 100;
								return h;
							}
					},
					{ display: '已还罚息合计(元)', name: 'totdefaultAmt', width: 100, enabledSort:true,
						editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.totdefaultAmt / 100;
								return h;
							}
					},
					{ display: '剩余本金合计(元)', name: 'overplusCapAmt', width: 100, enabledSort:true,
						editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.overplusCapAmt / 100;
								return h;
							}
					},
					{ display: '剩余利息合计(元)', name: 'overplusIntrAmt', width: 100 , enabledSort:true,
						editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.overplusIntrAmt / 100;
								return h;
							}
					},
					{ display: '剩余罚息合计(元)', name: 'overplusdefaultAmt', width: 100, enabledSort:true,
						editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.overplusdefaultAmt / 100;
								return h;
							}
					},
					{ display: '逾期租金合计(元)', name: 'overdueAmount', width: 100, enabledSort:true,
						editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.overdueAmount / 100;
								return h;
							}
					},
					{ display: '经营贷应收结清款(元)', name: 'clearAmt', width: 100, enabledSort:true,
						editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.clearAmt / 100;
								return h;
							}
					},
				],
				enabledEdit: true, 
				usePager: false,//是否有分页便签
				root:'rows',
				record:'total',
				hideLoadButton:false,
				width:'100%',
				isScroll: false,//是否有滚动条
				checkbox: false, //列表是否有选择框
				rownumbers:true//列表是否有行号
			});
			grid = liger.get("ligergrid_loan");
			grid.options.isSingleCheck = true;//列表是否为单选
		};
		 //初始化列表
		function initGrid_lng(id,cstId){
			
			$("#ligergrid_lng").ligerGrid({
				url:'<%=path%>/ass/assTrailCarFlowInfo/getMcrBillInfo.do',
				method:'get',
				parms:{tcMasterId:id,loanType:2},
				columns:[
					{ display: '贷款合同号', name: 'crCntNo', minWidth: 160, enabledSort:true},
					{ display: '贷款类型', name: 'crTypCd', minWidth: 150 , enabledSort:true,
						render: function (rowdata, rowindex, value, column) { 
							var h = '';
							if(rowdata.crTypCd=='FQHK'){
								h = '分期还款';
							}
							if(rowdata.crTypCd=='SJSH'){
								h = '随借随还';
							}
							return h;
						}
					
					},
					
					{ display: '实际贷款金额(元)', name: 'actCrAmt', width: 100 , enabledSort:true,
						 editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.actCrAmt / 100;
								return h;
							}
					},
					{ display: '已还本金合计(元)', name: 'totCapAmt', width: 100 , enabledSort:true,
						 editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.totCapAmt / 100;
								return h;
							}
					},
					{ display: '已还利息合计(元)', name: 'totIntrAmt', width: 100, enabledSort:true,
						editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.totIntrAmt / 100;
								return h;
							}
					},
					{ display: '已还罚息合计(元)', name: 'totdefaultAmt', width: 100, enabledSort:true,
						editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.totdefaultAmt / 100;
								return h;
							}
					},
					{ display: '剩余本金合计(元)', name: 'overplusCapAmt', width: 100, enabledSort:true,
						editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.overplusCapAmt / 100;
								return h;
							}
					},
					{ display: '剩余利息合计(元)', name: 'overplusIntrAmt', width: 100 , enabledSort:true,
						editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.overplusIntrAmt / 100;
								return h;
							}
					},
					{ display: '剩余罚息合计(元)', name: 'overplusdefaultAmt', width: 100, enabledSort:true,
						editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.overplusdefaultAmt / 100;
								return h;
							}
					},
					{ display: '逾期租金合计(元)', name: 'overdueAmount', width: 100, enabledSort:true,
						editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.overdueAmount / 100;
								return h;
							}
					},
					{ display: 'LNG贷应收结清款(元)', name: 'clearAmt', width: 100, enabledSort:true,
						editor:{type:"int"},
						 render: function (rowdata, rowindex, value, column) { 
								var h = 0;
				                h = rowdata.clearAmt / 100;
								return h;
							}
					},
				],
				enabledEdit: true, 
				usePager: false,//是否有分页便签
				root:'rows',
				record:'total',
				hideLoadButton:false,
				width:'100%',
				isScroll: false,//是否有滚动条
				checkbox: false, //列表是否有选择框
				rownumbers:true//列表是否有行号
			});
			grid = liger.get("ligergrid_lng");
			grid.options.isSingleCheck = true;//列表是否为单选
		};
	    //初始化数据
	    function initData(){
	    	var tcMasterId = $("#tcMasterId").val();
	    	if(!tcMasterId){
	    		$.ligerDialog.SQalert({content: "拖车申请主表ID为空,无法查询相关信息！",SQ_type: "error"});
	    		return;
	    	}
	    	var wait_dialog= $.ligerDialog.SQalert({
	            content: LogUtils.LOG_CMM_LOADING,
	            SQ_type: "waitting",
	            onClose: function () {
	            }
	        });
	    	//加载设备信息
	    	initGrid_equ(tcMasterId);
	    	//加载拖车主表信息
	    	var _url = '<%=path%>/ass/assTrailCarM/getTrailCarMaster.do';
	    	$.ajax({
	    		type: 'get',
	    		dataType:'json',
	    		data:{tcMasterId:tcMasterId},
	    		url: _url,
	    		success:function(msg){
	    			 wait_dialog.close();
	    			 if(msg.success == 1){
	    				 setData(msg.data);//设置数据
	    			 }else{
	    				 $.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
	    			 }
	    		}
	    	});
	    }
	    /* HOLLY START*/
		//初始化借款信息
		function initGrid_fin( ){
			var paySchId = $("#wsPaySchId").val();
			$("#ligergrid_fin").ligerGrid({
				parms:{paySchId:paySchId},
                url: '<%=path%>/finpayschfee/finance/getPaySchFeeList.do',
                method : 'get',
				columns:[
					{ display: '序号', name: 'feeRem', width: 40 , enabledSort:true,
						render: function (rowdata, rowindex, value, column) { 
							return rowindex+1;
						}},
					{ display: '借款类型', name: 'feeTypCdNm', width: 150, enabledSort:true },
					{ display: '借款金额(元)', name: 'feeAmt', width: 150, enabledSort:true,render:function (rowdata, rowindex, value, column){
						return value/100;
					} },
					{ display: '实付金额(元)', name: 'feeAmt', width: 150 , enabledSort:true,render:function (rowdata, rowindex, value, column){
						return value/100;
					}},
					{ display: '已核销金额(元)', name: 'paidUpAmt', width: 150, enabledSort:true,render:function (rowdata, rowindex, value, column){
						return value/100;
					}},
					{ display: '实付时间', name: 'crtTm', width: 200, enabledSort:true,render: function (rowdata, rowindex, value, column) { 
						var dateStr = "";
						if(null != value){
							var date = new Date(value);
							dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
						}
						return dateStr;
						}},
					{ display: '付款单号', name: 'feeRem', width: 200, enabledSort:true,
						render: function (rowdata, rowindex, value, column) { 
							var h ="";
							if( rowdata.pNo != null){
				                h+='<a class="sq-button-hasicon" href="javascript:commShowFlow(';
				                h+="'"+rowdata.pinstId+"'";
				                h+=",'"+rowdata.audStsCd+"'";
				                h+=",'"+rowdata.dataId+"'";
				                h+=",'"+rowdata.formUrl+"'";
				                h+=")\"><i class='sqBtnIco_32'></i>"+rowdata.pNo+"</a>";
							}
							return h;
						}},
					{ display: '备注', name: 'feeRem', width: 200, enabledSort:true }
				],
				onAfterShowData :function (e){
					var rows=e.rows;
					var i=0;
					for ( var index in rows) {
						i+=rows[index].arAmt;
					}
					 $("#arAmts").text(i/100+" 元");
				},
				usePager: false,//是否有分页便签
				root:'rows',
				record:'total',
				hideLoadButton:false,
				width:'100%',
				height:'100%',
				heightDiff:-2,
				isScroll: false,//是否有滚动条
				checkbox:false,//列表是否有选择框
				rownumbers:false//列表是否有行号
			});
		}
		//显示流程：流程实例ID,状态,业务主键(拖车主表ID)
	    function commShowFlow(_pInstId, _audStsCd, _businessKey,_formUrl){
	    	if(StringUtils.isEmpty(_pInstId)){
	    		UIUtils.alertWarning(CommonConstant.C_P_INSTANCEID_NOT_HERE);
	    		return;
	    	}
	    	var params = "?pInsId="+_pInstId+"&status="+_audStsCd+"&businessKey="+_businessKey+"&formUrl="+_formUrl;
	    	Add_navTab('tab_ass_trail_flow_'+_businessKey,'查看流程',"<%=path%>/flow/flow/toFlowShowPageFowBus.do"+params);
	    }
		
	    /* HOLLY END*/
	    //设置页面数据
	    function setData(data){
			//显示申请信息
			$("#applyNm").html(data.applyNm);
 	    	$("#applyDt").html(renderDate1(data.applyDt));
			$("#backReason").html(data.backReason);
			//设置用来显示的元素值
			$("#companyNm").html(data.companyNm);
			$("#backDt").html(renderDate1(data.backDt));
			//$("#backPrice").html(data.backPrice / 100);
			//$("#backQty").html(data.backQty);
			//$("#backAmt").html(data.backAmt / 100);
			$("#payeeAccNm").html(data.payeeAccNm);
			$("#payeeBankNm").html(data.payeeBankNm);
			$("#payeeBankNo").html(data.payeeBankNo);
			$("#payeeAccNo").html(data.payeeAccNo);
			//显示拖回保管城市等信息
			$("#parkNm").html(data.parkNm);
			$("#assMgs").html(data.assManagers);
			$("#parkAddress").html(data.parkAddress);
			$("#provinceCity").html(data.provinceCity);
			//显示付款信息
			$("#payerBankNm").html(data.payerBankNm);
			$("#payerAccNo").html(data.payerAccNo);
			$("#payerAccNm").html(data.payerAccNm);
            liger.get("backWayCd").selectValue(data.backWayCd);
            liger.get("isSendFile").selectValue(data.isSendFile);
            $("#notSendReason").val(data.notSendReason);
            setHjShow(data.isSendFile);
            liger.get("expressNm").selectValue(data.expressNm);
            $("#expressNum").val(data.expressNum);
            liger.get("rcvRelationship").selectValue(data.rcvRelationship);
            $("#rcvNm").val(data.rcvNm);
            $("#rcvTel").val(data.rcvTel);
            $("#rcvAddr").val(data.rcvAddr);
	    }
	    
		//初始化列表
		function initGrid_equ(id){
			var flag = $("#flag").val();
			$("#ligergrid_equ").ligerGrid({
				url:'<%=path%>/ass/assTrailCarM/getTrailCarDetail.do',
				method:'get',
				parms:{tcMasterId:id},
				columns:[
					{ display: '租赁物名称', name: 'prdNm', minWidth: 120, enabledSort:true,
						render: function (rowdata, rowindex, value, column) { 
							var h = rowdata.prdNm;
							initPkData(rowdata);//设置主键值及主要信息
							return h;
						}},
					{ display: '型号', name: 'prdMdl', minWidth: 120 , enabledSort:true},
					{ display: '是否新车', name: 'isNew', width: 100 , enabledSort:true,
						render: function (rowdata, rowindex, value, column) { 
							var h = '否';
							if(rowdata.isNew==1){
								h = '是';
							}
							return h;
						}},
					{ display: '<font color="red">GPS是否在线</font>', name: 'isOnline', width: 120, enabledSort:true,
						render: function (rowdata, rowindex, value, column) { 
							var h = '';
							var online = '';
				 	    	h+='<select id="isOnline" name="isOnline">';
				 	    	h+='<option value="0" ';
				 	    	if(rowdata.isOnline==0){
				 	    		h+='selected';
				 	    		online = '否';
				 	    	}
				 	    	h+='>否</option>';
				 	    	h+='<option value="1" ';
				 	    	if(rowdata.isOnline==1){
				 	    		h+='selected';
				 	    		online = '是';
				 	    	}
				 	    	h+='>是</option></select>';
				 	    	//判断是否为显示
				 	    	if(flag!="2"){
				 	    		h = online;
				 	    	}
							return h;
						}},
					{ display: '使用期限(月)', name: 'usedPd', width: 100 , enabledSort:true},
					{ display: '单价', name: 'guidePc', width: 100, enabledSort:true,
						render: function (rowdata, rowindex, value, column) { 
							var h = 0;
			                h = rowdata.guidePc / 100;
							return h;
						}},
					{ display: '数量', name: 'prdQty', width: 100, enabledSort:true},
					{ display: '留购价', name: 'rsrvPc', width: 100, enabledSort:true,
						render: function (rowdata, rowindex, value, column) { 
							var h = 0;
			                h = rowdata.rsrvPc / 100;
							return h;
						}},
					//{ display: '买卖合同编号', name: 'salContNo', width: 100 , enabledSort:true},
					{ display: '车辆配置单', name: 'overdueAmt', width: 100, enabledSort:true,
						render: function (rowdata, rowindex, value, column) { 
							var h = '';
							h+='<a href="javascript:showOp(';
			                h+="'"+rowdata.prjId+"'";
			                h+=",'"+rowdata.prjPrdId+"'";
			                h+=")\">查看</a>";
							return h;
						}}
				],
				usePager: false,//是否有分页便签
				root:'rows',
				record:'total',
				hideLoadButton:false,
				width:'100%',
				isScroll: false,//是否有滚动条
				checkbox:false,//列表是否有选择框
				rownumbers:true//列表是否有行号
			});
			grid = liger.get("ligergrid_equ");
			grid.options.isSingleCheck = true;//列表是否为单选
		}
		
		//设置关键字的值-各表主键
		function initPkData(rowdata){
			//加载表单
	    	var form = liger.get("trailCar_view");
			var tcDetailId = $("#tcDetailId").val();
			if(!tcDetailId){//为空执行
				form.setData({
					tcDetailId: rowdata.id,//拖车明细表ID
		    	});
			}
			form.setData({
				tcInfoId: rowdata.infoId,//拖车实际明细表ID
				paySchId: rowdata.paySchId,// 发起拖车流程的支付表id（启用）
				paySchNo: rowdata.paySchNo,// 发起拖车流程的支付表号（启用）
				prjId: rowdata.prjId //项目ID
	    	});
			//设置支付表可查看
			var paySchNo='<a href="javascript:payDetail(';
			paySchNo+="'"+rowdata.prjPrdDtlId+"',"; //项目产品明细信息表ID
			paySchNo+="'"+rowdata.paySchId+"',"; //支付表ID
			paySchNo+="'"+rowdata.prjPrdId+"',"; //项目产品基础信息表ID
			paySchNo+="'"+rowdata.prjId+"'"; //项目基础信息表ID
			paySchNo+=')">'+rowdata.paySchNo+'</a>';
            $("#prjPrdDtlId").val(rowdata.prjPrdDtlId);
            // 初始化疫情信息
            initData_yq();
			//设置基本信息显示
 	    	$("#cstNm").html(rowdata.cstNm);
 	    	$("#contNo").html(rowdata.contNo);
 	    	$("#paySchNo_1").html(paySchNo);
 	    	$("#splNm").html(rowdata.splNm);
 	    	$("#orgName").html(rowdata.orgName);
 	    	$("#cstMgrNm").html(rowdata.cstMgrNm);
			//设置逾期信息
			$("#lsPd").html(rowdata.lsPd);
 	    	$("#actualAmt").html(rowdata.actualAmt / 100);
 	    	$("#overdueAmt").html(rowdata.overdueAmt / 100);
 	    	$("#overdueDay").html(rowdata.overdueDay);
 	    	$("#penaltyAmt").html(rowdata.penaltyAmt / 100);
			$("#payAmt").html(rowdata.payAmt / 100);
			$("#backPrice").html(rowdata.backPrice / 100);
			$("#backQty").html(rowdata.backQty);
			$("#backAmt").html(rowdata.backAmt / 100);
			$("#costFileRem").val(rowdata.costFileRem);
			//乘用车核算保底价-添加留购价
			if(rowdata.paySchNo.indexOf("CA")>0){
				$("#rsrvPc").html(rowdata.rsrvPc / 100);//留购价
				$("#trailCar_view").find(".lgj_cyc").each(function (){
	        		$(this).removeClass('Hide');
	        	});
				//为了美观-加了空格
				$("#trailCar_view").find(".show_cyc").each(function (){
	        		$(this).removeClass('Hide');
	        	});
			}else{//不可编辑
				$("#trailCar_view").find(".lgj_cyc").each(function (){
	        		$(this).addClass('Hide');
	        	});
				//为了美观-加了空格
				$("#trailCar_view").find(".show_cyc").each(function (){
	        		$(this).addClass('Hide');
	        	});
			}
			//初始化实际明细信息
			initDInfoData();
			//加载出入口资料文件列表信息
	    	loadFilesLiger("crkzl", 2, $("#tcDetailId").val());
	    	
	    	//加载借款信息
	    	initGrid_fin();
		}
		
	    //初始化拖车实际明细表数据
	    function initDInfoData(){
	    	var tcInfoId = $("#tcInfoId").val();
	    	if(!tcInfoId){
	    		//$.ligerDialog.SQalert({content: "拖车实际明细表ID为空,无法查询相关信息！",SQ_type: "error"});
	    		return;
	    	}else{
		    	var wait_dialog= $.ligerDialog.SQalert({
		            content: LogUtils.LOG_CMM_LOADING,
		            SQ_type: "waitting",
		            onClose: function () {
		            }
		        });
		    	//加载拖车实际明细信息
		    	var _url = '<%=path%>/ass/assTrailCarDInf/getById.do';
		    	$.ajax({
		    		type: 'get',
		    		dataType:'json',
		    		data:{tcInfoId:tcInfoId},
		    		url: _url,
		    		success:function(msg){
		    			 wait_dialog.close();
		    			 if(msg.success == 1){
		    				 setDInfData(msg.data);//设置数据
		    			 }else{
		    				 $.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
		    			 }
		    		}
		    	});
	    	}
	    }
	    
	    //设置拖车实际明细信息
	    function setDInfData(data){
	    	$("#futureAmt").html(data.futureAmt / 100);
	    	$("#overRentAmt").html(data.overRentAmt / 100);
	    	$("#performanceAmt").html(data.performanceAmt / 100);
	    	$("#insureAmt").html(data.insureAmt / 100);
	    	$("#riskAmt").html(data.riskAmt / 100);
	    	$("#otherAmt").html(data.otherAmt / 100);
	    	$("#baseAmt").html(data.baseAmt / 100);
			$("#actPayDt").html(renderDate1(data.actPayDt));
			$("#actPayAmt").html(data.actPayAmt / 100);
			$("#actBackDt").html(renderDate1(data.actBackDt));
			initMoneyData(data.futureAmt);//初始化金额数据
	    }
	    
	  	//初始化财务核算保底价金额数据
	    function initMoneyData(futureAmt){
	    	var paySchId = $("#paySchId").val();
	    	if(!paySchId){
	    		//$.ligerDialog.SQalert({content: "支付表ID为空,无法查询相关信息！",SQ_type: "error"});
	    		return;
	    	}else{
		    	//加载拖车实际明细信息
		    	var _url = '<%=path%>/ass/assTrailCarDInf/getMoneyByPaySchId.do';
		    	$.ajax({
		    		type: 'get',
		    		dataType:'json',
		    		data:{paySchId:paySchId},
		    		url: _url,
		    		success:function(msg){
		    			 if(msg.success == 1){
		    				 setMoneyData(msg.data,futureAmt);//设置数据
		    			 }else{
		    				 $.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
		    			 }
		    		}
		    	});
	    	}
	    }
	    
	    //设置财务核算保底价金额数据
	    function setMoneyData(data,futureAmt){
	    	//判断未来本金是否为空
	    	if(0 != futureAmt && !futureAmt){//为空执行
	    		$("#futureAmt").html(data.futureAmt / 100);
		    	$("#overRentAmt").html(data.overRentAmt / 100);
		    	$("#performanceAmt").html(data.performanceAmt / 100);
		    	$("#insureAmt").html(data.insureAmt / 100);
		    	$("#riskAmt").html(data.riskAmt / 100);
		    	$("#otherAmt").html(data.otherAmt / 100);
		    	$("#baseAmt").html(data.baseAmt / 100);
		    	calculateBaseAmt();//计算保底价
	    	}
	    }
		
		//拖车申请 计算保底价
		function calculateBaseAmt(){
            var overRentAmt = (isNaN($("#overRentAmt").val()) || $("#overRentAmt").val() == '')?0:$("#overRentAmt").val();//逾期租金
            var futureAmt = (isNaN($("#futureAmt").val()) || $("#futureAmt").val()=='')?0:$("#futureAmt").val();//未来本金
            var actPayAmt = (isNaN($("#actPayAmt").val()) || $("#actPayAmt").val()=='')?0:$("#actPayAmt").val();//实际付款金额
            var otherAmt = (isNaN($("#otherAmt").val()) || $("#otherAmt").val()=='')?0:$("#otherAmt").val();//其他费用

            var performanceAmt = (isNaN($("#performanceAmt").val()) || $("#performanceAmt").val()=='')?0:$("#performanceAmt").val();//履约保证金
            var insureAmt = (isNaN($("#insureAmt").val()) || $("#insureAmt").val()=='')?0:$("#insureAmt").val();//保险保证金
            var riskAmt = (isNaN($("#riskAmt").val()) || $("#riskAmt").val()=='')?0:$("#riskAmt").val();//风险保证金

            var baseAmt = 0;
            baseAmt = parseFloat(overRentAmt) + parseFloat(futureAmt) +parseFloat(actPayAmt) +
                parseFloat(otherAmt) - parseFloat(performanceAmt)-parseFloat(insureAmt)-parseFloat(riskAmt);
            $("#baseAmt").val(anyString(baseAmt,2));//保留2位
		}
	    
	    //设置出入库编辑状态
	    function setEnterOutAttr(){
			var crflag = $("#crflag").val();
			//拖车交接单编辑情况
			if(crflag == "entry"){//入库
	        	$(".entry").removeClass('Hide');
	        	$(".out").addClass('Hide');
	        	$(".detail").addClass('Hide');
			}else if(crflag == "out"){//出库
	        	$(".entry").addClass('Hide');
	        	$(".out").removeClass('Hide');
	        	$(".detail").addClass('Hide');
			}else{//查看
				$(".entry").addClass('Hide');
	        	$(".out").addClass('Hide');
	        	$(".detail").removeClass('Hide');
			}
	    }
	    
	  	//出入库交接单
		function entryOrder(crflag){
			var tcMasterId = $("#tcMasterId").val();//拖车主表ID
			var tcDetailId = $("#tcDetailId").val();//拖车明细ID
			var paySchId = $("#wsPaySchId").val();//支付表ID
			var paySchNo = $("#wsPaySchNo").val();//支付表号
			var prjId = $("#prjId").val();//项目ID
			var param = '&&tcMasterId='+tcMasterId+'&&tcDetailId='+tcDetailId+'&&crflag='+crflag;
			param += '&&paySchId='+paySchId+'&&paySchNo='+paySchNo+'&&prjId='+prjId;
			Add_navTab('entryOrder'+tcDetailId,'车辆交接单','<%=path%>/ass/assTrailCarM/toWarehousePage.do?' + param);
		}
		
		//查看支付表详情
		function payDetail(prjPrdDtlId,id,prjPrdId,prjId){
			var editFlag = true;
			Add_navTab('tab_prj_quat_prps'+id,'查看支付表','<%=path%>/project/prjprdpayschm/toAddPage.do?prjId='+prjId+'&&id='+id+'&&prjPrdDtlId='+prjPrdDtlId+'&&prjPrdId='+prjPrdId+'&&detailFlag='+editFlag);
		}
		
		//导出车辆交接单PDF
	    function exportAssCarHvPdf(){
	    	var tcDetailId = $("#tcDetailId").val();//拖车明细ID
	        window.location.href='<%=path%>/ass/assTrailCarD/exportAssCarHvPdf.do?tcDetailId='+tcDetailId;
	    }
		
		//车辆配置单
		function showOp(_prjId,_prjPrdId){
		    Add_navTab("corePrcBook"+_prjPrdId, "车辆配置单", '<%=path%>/audit/audStandingBook/toCorePrcBookAddPage.do?prjPrdId='+_prjPrdId+'&proIntId='+$("#proIntId").val()+'&projectId='+_prjId+'&isDetail='+1);
		}
		
		//费用大类
		var costMainCdListJSON = [];
	    <c:if test="${not empty costMainCdListJSON}"> costMainCdListJSON = ${costMainCdListJSON}; </c:if>
	    //费用小类
	    var costSubCdListJSON = [];
	    var costGrid;
		//初始化杂费信息列表
		var beforeCostMainCd = '';
		var afterCostMainCd = '';
		function initCostGrid(){
			costGrid = $("#ligergrid_cost").ligerGrid({
		        url: '<%=path%>/ass/assDealSellCost/initList.do',
		        method: 'get',
		        parms:{
		        	tcDetailId:'${tcDetailId}'
		        },
		        columns: [
		            {display: '费用大类(<span class="c_red">*</span>)', name: 'costMainCd', width: 150,
		                editor: {
		                	type: 'select',
		                    data: costMainCdListJSON,
		                    valueField: 'key',
		                    textField: 'value',
		                },
		                valueField: 'costMainCd',
		                textField: 'costMainCdNm',
		                render: function (item) {
		                    return item.costMainCdNm;
		                }
		            },
		            {display: '费用小类(<span class="c_red">*</span>)', name: 'costSubCd', width: 150,
		                editor: {
		                    type: 'select',
		                    data: costSubCdListJSON,
		                    valueField: 'key',
		                    textField: 'value'
		                },
		                valueField: 'costSubCd',
		                textField: 'costSubCdNm',
		                render: function (item) {
		                    return item.costSubCdNm;
		                }
		            },
		            {display: '费用金额(<span class="c_red">*</span>)', name: 'costAmtDouble', width: 120, type: 'text',align: 'right',
		            	editor: {type: 'number',precision:2,
		                	toFix:true,
		    				onToFix:function(){
		    					 top.$.ligerDialog.SQalert({SQ_type: "warning",content: "小数点后面最多2位小数！"});
		    				}
						}
		            },
		            {display: '添加人', name: 'crtUsrIdNm', width: 80, editor: {readonly: true}},
		            {
		                display: '添加时间', name: 'crtTm',width: 120,
		                editor: {type: 'date'},
		                readonly: true,
		                render: function (rowdata, index, value) {
		                    var result = '';
		                    if (StringUtils.isEmpty(value)) return result;
		                    var date = new Date(value);
		                    result = date.Format('yyyy-MM-dd');
		                    return result;
		                }
		            },
		            {display: '费用说明(<span class="c_red">*</span>)', name: 'costRem', minWidth: 100, editor: {type: 'text'} },
		            { display: '操作', width: 80 , align:'left',
   		            	render: function (rowdata, rowindex, value){
   		                	var d = "";
   		                	var mdfSellCost = '${mdfSellCost}';
   		                	if(mdfSellCost==1){
								if(rowdata.id){
									d='<a class="sq-button-hasicon" href="javascript:deleteDB(';
									d+="'"+rowdata.__id+"'";
									d+=",'"+rowdata.id+"'";
									d+=')"><i class="sqBtnIco_7"></i>删除</a>';
								}else{
									d='<a class="sq-button-hasicon" href="javascript:deletePage(';
									d+="'"+rowdata.__id+"'";
									d+=')"><i class="sqBtnIco_7"></i>删除</a>';
								}
   		                	}
   		                    return d;
   		            	}
   		            }
		        ],
		        onBeforeEdit: function (e) {
		            if (e.column.columnname == "costMainCd") {
		            	beforeCostMainCd = e.value;
		            }
		            if (e.column.columnname == "costSubCd") {
		                getCostSubCdListJSON(e.record.costMainCd);
		                e.column.editor.data=costSubCdListJSON;
		            }
		            var mdfSellCost = '${mdfSellCost}';
		            if(mdfSellCost!=1){
			            e.column.editor.readonly=true;
		            }
		        },
		        onBeforeSubmitEdit: function (e) {
		        	if (e.column.columnname == "costMainCd") {
		            	afterCostMainCd = e.value;
		            }
		        	if (e.selected && e.column.columnname == "costMainCd" && afterCostMainCd!=beforeCostMainCd) {
		                e.record.costSubCd ="";
		                e.record.costSubCdNm ="";
		            }
		        	beforeCostMainCd = '';
		        	afterCostMainCd = '';
		        },
		        pageSize:100,
		        usePagerOnLessPagesize: false,
		        root: 'rows',
		        record: 'total',
		        hideLoadButton: true,
		        width: '90%',
		        height: 300,
		        heightDiff: -2,
		        enabledEdit: true,
		        isScroll: false,
		        checkbox: false,
		        rownumbers: true,
		        allowUnSelectRow: true,
		        alternatingRow: false,
		        enabledSort:false
		    });
		}
		//获取费用小类
		function getCostSubCdListJSON(costMainCd){
			if(!costMainCd){
		        top.$.ligerDialog.SQalert({content: "请先选择费用大类", SQ_type: "warning"});
		        return;
		    }
			$.ajax({
				type: 'post',
				dataType:'json',
				async: false,
				data:{
					PCode:costMainCd
				},
				url: '<%=path%>/ass/assTrailCarM/getCostCdJSON.do',
				success:function(msg){
					if(msg.success == 1){
						costSubCdListJSON=msg.data;
					}
				}
			});
		}
		//保存杂费信息
		function saveCost(){
		    var url = '<%=path%>/ass/assDealSellCost/add.do';
		    var wait_dialog;
		    $.ajax({
				type: 'post',
				dataType:'json',
				data:{
						"tcDetailId":'${tcDetailId}',
						"costGridJSON":JSON.stringify(costGrid.getData())
						},
				url: url,
				beforeSend: function(){
			          wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
			     },
				success:function(msg){
					 wait_dialog.close();
					 if(msg.success == 1){
						 $.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
						 costGrid.reload();
					 }else{
						 $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
					 }
				}
			});
		}
		//保存杂费附件备注信息
		function saveCostFileRem(){
			var costFileRem = $("#costFileRem").val();
			/* if(!costFileRem || costFileRem==" "){
	   	   		top.$.ligerDialog.SQalert({content: "备注为空.", SQ_type: "warning"});
	   	   		return;
	   		} */
		    var url = '<%=path%>/ass/assTrailCarD/modifyCostFileRem.do';
		    var wait_dialog;
		    $.ajax({
				type: 'post',
				dataType:'json',
				data:{
						"tcDetailId":'${tcDetailId}',
						"costFileRem":costFileRem
						},
				url: url,
				beforeSend: function(){
			          wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting" });
			     },
				success:function(msg){
					 wait_dialog.close();
					 if(msg.success == 1){
						 $.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
					 }else{
						 $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
					 }
				}
			});
		}
		function deleteDB(rowdata_id,_id){
        	//删除数据库
        	$.ligerDialog.confirm(LogUtils.LOG_CMM_DELETE_CONFIRM, function (flag) {
        		if(flag == false)return;
        		var wait_dialog;
        		$.ajax({
        			type: 'post',
        			dataType:'json',
        			data:{id:_id},
        			url: '<%=path%>/ass/assDealSellCost/removeById.do',
        			beforeSend: function(){
        			     wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING,SQ_type:"waitting"});
        			},
        			success:function(msg){
        				wait_dialog.close();
        				 if(msg.success == 1){
        					 $.ligerDialog.SQalert({content:msg.info, SQ_type: "success"});
        					 costGrid.reload();
        				 }else{
        					 $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
        				 }
        			}
        		});
        	});
        }
        function deletePage(rowdata_id){
        	$.ligerDialog.confirm(LogUtils.LOG_CMM_DELETE_CONFIRM, function (flag) {
        		if(flag == false)return;
        		//删除页面
       			costGrid.deleteRow(rowdata_id);
        	})
        }
        
        function addRecord(){
        	costGrid.addRow({
        		costMainCd: '',
        		costSubCd: '',
        		costAmtDouble: '',
        		crtUsrIdNm:'${currentUserName}',
        		crtTm:'${currentDate}',
        		costRem:'',
            });
        }
        
        var costFileGrid;
        function initCostFlie(){
        	costFileGrid = $("#costFileGrid").ligerGrid({
                url: '<%=path%>/ass/assDealSellCost/initFileInfoList.do?cfgCd=ASS003&dataId=${tcDetailId}',
                method: 'get',
                columns: [
                    /* {display: '资料名称', name: 'datNm', minWidth: 100, align: 'left', enabledSort: false}, */
                    {display: '上传文件名称', name: 'fileNm', minWidth: 100, align: 'left', enabledSort: false,
                        render:function(rowdata,rowindex,value){
                            if(value){
                                //return '<a target="_blank" name="showimg" href="'+rowdata.filePath+'">'+rowdata.fileNm+'</a>';
                                var h;
                                h='<a href="javascript:uploadFileByUrl(';
                                h+="'"+rowdata.filePath+"'";
                                h+=",'"+rowdata.fileNm+"'";
                                h+=')">'+rowdata.fileNm+'</a>'
                                return h;
                            }
                        }
                    },
                    {display: '上传时间', name: 'crtTm', minWidth: 100, align: 'left', enabledSort: false,render:renderDate},
                    {display: '操作', name: '', minWidth: 100, align: 'left', enabledSort: false,
                        render:function(rowdata,rowindex,value){
                            var h='';
                            var mdfSellCost = '${mdfSellCost}';
                            if(mdfSellCost==1){
                            	if(rowdata.fileId && rowdata.audStsCd!=1) {
   	                                h += '<a class="sq-button-hasicon" style="cursor:pointer;" onclick="delFile(event,' + rowdata.fileId + ');"><i class="sqBtnIco_7"></i>删除</a>';
                                }
                            }
                            return h;
                        }
                    },
                    {display: '上传', name: 'uploadNm', width: 80,align: 'left', enabledSort: false,
                        render:function(rowdata,rowindex,value){
                            var h='';
                            var mdfSellCost = '${mdfSellCost}';
                            if(mdfSellCost==1){
   	                            h+='<span class="sq-button sq-button-round fileupload-button">上传<input type="file" id="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'" multiple name="fileup_'+rowdata.cfgCd+'_'+rowdata.cfgDtlCd+'"' +
   	                                    ' class="fileupload-input" onchange="onChangefile_multi(event,\''+rowdata.cfgCd+'\',\''+rowdata.cfgDtlCd+'\',\''+rowdata.orgCd+'\',1)"></span>';
                            }
                            return h;
                        }
                    },
                ],
                root: 'rows',
                hideLoadButton : true,
                width: '100%',
                height: '100%',
                isScroll: false,
                rownumbers:true,  //显示序号
                checkbox: false,
                allowUnSelectRow:true,
                alternatingRow: false,
                frozen: false,
                usePager: false,
                onAfterShowData: function (){
                    $('#costFileGrid').rowspan('datNm');
                    $('#costFileGrid').rowspan('uploadNm');
                }
            });
        }
        
        function uploadFileByUrl(_url,_name){
    		if(SQ.regs.img.test(_name)){
    			//SQ.imgPreview(_url);
    			//SQ.imgPreview(_url, true);
    	       window.__ImgSrc = _url;
    	       window.__ImgTit = _name;
    	       window.open('<%=path%>/project/prjbscinfo/imgWinOpen.do', '', 'location=yes, width=800, height=600');
    		}else{
    	        window.open(_url);
    		}
        }
        
      //删除文件
        function delFile(event,_fileId){
        	top.$.ligerDialog.confirm("确认删除吗?", function (flag) {
        	     if(!flag){
        	          return;
        	     }else{
        	    	 var wait_dialog;
        	         $.ajax({
        	             type: 'post',
        	             dataType: 'json',
        	             data: {'fileId':_fileId},
        	             url: '<%=path%>/project/prjFileInfo/removeFile.do',
        	             beforeSend: function () {
        	                wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
        	             },
        	             success: function (msg) {
        	                 wait_dialog.close();
        	                 if (msg.success == 1) {
        	                     $.ligerDialog.SQalert({content: msg.info, SQ_type: "success"});
        	                     parent.$('li[tabid="mateTab"] a').text('杂费资料('+msg.data+')');
        	                     event.stopPropagation();
        	                     var gridID = $(event.target).parents('.sq-grid').attr('ligeruiid');
        	                     liger.get(gridID).reload();
        	                 }else{
        	                     $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
        	                 }
        	             }
        	         });     
        	     }
        	});
        }
      
        function onChangefile_multi(e,cfgCd,cfgDtlCd,orgCd,typ) {
            var wait_dialog = $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING, SQ_type: "waitting"});
            var filePath="";
            if(typ==1){
                filePath="ass";
            }

            $.ajaxFileUpload({
                url: '<%=path%>/system/sysulfilesrec/upload.do',
                secureuri: false,
                fileElementId: e.target.id,  //这里不在是以前的id了，要写成数组的形式！
                dataType: 'json',
                data: {filePath: filePath},
                success: function (msg) {
                    if (msg.success == 1) {
                        if(typ==1){
                            $.ajax({
                                type: 'post',
                                dataType: 'json',
                                data: {'fileParams':JSON.stringify(msg.data),'dataId':'${tcDetailId}','tabNm':'ASS_TRAIL_CAR_D','cfgCd':cfgCd,'cfgDtlCd':cfgDtlCd,'orgCd':orgCd},
                                url: '<%=path%>/ass/assDealSellCost/uploadFile.do',
                                success: function (msg) {
                                    if (msg.success == 1) {
                                    	costFileGrid.reload();
                                    }else{
                                        $.ligerDialog.SQalert({content: "资料上传超时", SQ_type: "error"});
                                    }
                                    $.ligerDialog.hide();
                                }
                            });
                        }
                    } else {
                        wait_dialog.close();
                        $.ligerDialog.SQalert({content: msg.info, SQ_type: "error"});
                    }
                }
            });
        };
        
        function renderDate(rowdata, index, value) {
            var dateStr = "";
            if (null != value) {
                var date = new Date(value);
                dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DDHHMMSS);
            }
            return dateStr;
        }
    </script>
</body>
</html>